package com.xzm.MQ.topics;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.xzm.MQ.utils.RabbitMQUtils;

import java.io.IOException;

public class Provider {
    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare("logs_topic","topic");
        String routekey="user.save";
        channel.basicPublish("logs_topic",routekey,null,"这是发送的消息".getBytes());
        RabbitMQUtils.closeChannelAndConnetion(channel,connection);
    }
}
